package com.example.startscreen;

import com.example.startscreen.Category.categoryEnum;

public class Municipal extends MyLocation {

	static enum municipalEnum {
		Podgorica(1), 
		Budva(2), 
		Kotor(3), 
		HercegNovi(4), 
		Zabljak(5), 
		Niksic(6), 
		Bar(7), 
		Cetinje(8), 
		Kolasin(9), 
		Plav(10), 
		Rozaje(11), 
		Mojkovac(12), 
		Pljevlja(13),
		Berane(14), 
		Tivat(15), 
		Ulcinj(16), 
		Andrijevica(17), 
		Danilovgrad(18), 
		Savnik(19), 
		Pluzine(20), 
		BijeloPolje(21), 
		CrnaGora(100);

		private int value;

		public static municipalEnum valueOf(int id) {
			
			municipalEnum[] values = municipalEnum.values(); 

			// Iterate through the list and return the proper one; else throw exception. 
			for ( municipalEnum e : values ) { 
				if ( e.ordinal() == id ) { 
					return e; 
				}
			}

			// if we made it here, then we did not find any corresponding 
			// enumeration to return; throw an IllegalArgumentException. 
			throw new IllegalArgumentException( "Ordinal: " + id + " is not a valid enumeration value." ); 

		}

		public static int getInt(municipalEnum e) {
			return e.getValue();
		}

		private municipalEnum(int value) {
			this.value = value;
		}

		public int getValue() {
			return value;
		}
	}

	static Municipal[] arrMunicipal = {
		new Municipal(1,"Podgorica","42.441258,19.262724","http://www.podgorica.travel/","cities/podgorica.xml"),
		new Municipal(2,"Budva","42.285247,18.842626","http://www.budva.travel/","cities/budva.xml"),
		new Municipal(3,"Kotor","42.425163,18.769782","http://www.tokotor.me/","cities/kotor.xml"),
		new Municipal(4,"Herceg Novi","42.45193,18.536253","http://www.hercegnovi.cc/","cities/hercegnovi.xml"),
		new Municipal(5,"Žabljak","43.155262,19.121189","http://www.zabljak.me/","cities/zabljak.xml"),
		new Municipal(6,"Nikšić","42.77633,18.950558","http://www.niksic.montenegro.travel/","cities/niksic.xml"),
		new Municipal(7,"Bar","42.0987,19.09529","http://www.visitbar.org/","cities/bar.xml"),
		new Municipal(8,"Cetinje","42.391135,18.913994","http://www.cetinje.montenegro.travel/","cities/cetinje.xml"),
		new Municipal(9,"Kolašin","42.823531,19.521203","http://www.kolasin.me/","cities/kolasin.xml"),
		new Municipal(10,"Plav","42.59805,19.939563","http://www.plav.net/","cities/plav.xml"),
		new Municipal(11,"Rožaje","42.843028,20.168259","http://www.rozaje.me/","cities/rozaje.xml"),
		new Municipal(12,"Mojkovac","42.962735,19.582508","http://www.mojkovac.me/","cities/mojkovac.xml"),
		new Municipal(13,"Pljevlja","43.356046,19.357996","http://www.pljevlja.me/","cities/pljevlja.xml"),
		new Municipal(14,"Berane","42.845891,19.878259","http://www.berane.me/","cities/berane.xml"),
		new Municipal(15,"Tivat","42.429792,18.69946","http://www.tivat.travel/","cities/tivat.xml"),
		new Municipal(16,"Ulcinj","41.930108,19.210818","http://www.opstinaulcinj.com/","cities/ulcinj.xml"),
		new Municipal(17,"Andrijevica","42.73338,19.792675","http://www.andrijevica.me/","cities/andrijevica.xml"),
		new Municipal(18,"Danilovgrad","42.5521,19.105268","http://www.danilovgrad.me/","cities/danilovgrad.xml"),
		new Municipal(19,"Šavnik","42.959218,19.09411","http://www.savniknadlanu.net/","cities/savnik.xml"),
		new Municipal(20,"Plužine","43.154416,18.841295","http://www.strawhost.net/~pluzine/page.php?cat=2","cities/pluzine.xml"),
		new Municipal(21,"Bijelo Polje","43.036478,19.746122","http://www.bijelopolje.co.me/","cities/bijelopolje.xml"),
	};

	public static String getName(int cityID) {
		String s = "";
		for (int i=0; i < arrMunicipal.length; i++) {
			if (arrMunicipal[i].cityID == cityID)
				return arrMunicipal[i].name;
		}
		return s;
	}

	public static String getUrl(int cityID) {
		String s = "";
		for (int i=0; i < arrMunicipal.length; i++) {
			if (arrMunicipal[i].cityID == cityID)
				return arrMunicipal[i].url;
		}
		return s;
	}

	public static String getDescription(int locID) {
		String s = "";
		for (int i=0; i < arrMunicipal.length; i++) {
			if (arrMunicipal[i].locID == locID)
				return arrMunicipal[i].description;
		}
		return s;
	}

	public Municipal(int cityID, String name, String latlongpair, String url, String description) {
		// NOTE: Municipal locID MUST be the same as cityID
		// catID is zero, as it is nonsense for municipals!!!
		super(cityID, Category.categoryEnum.MUNICIPALS.getValue(), cityID, name, name, latlongpair, url, description);
	}
	
}
